#ifndef WATCHLIST_HPP
#define WATCHLIST_HPP

#include <QDockWidget>
#include <QMap>
#include <QMapIterator>
#include <QTableWidgetItem>
#include <QList>

#include "datamemoryorganisation.hpp"
#include "register.hpp"

namespace Ui {
    class WatchList;
}

/**
* @brief
*
* @class WatchList watchlist.hpp "watchlist.hpp"
*/
class WatchList : public QDockWidget {
    Q_OBJECT

public:
    /**
    * @brief
    *
    * @fn WatchList
    * @param parent
    */
    WatchList(QWidget *parent = 0);

    /**
    * @brief
    *
    * @fn ~WatchList
    */
    ~WatchList();

    void reset();

    void updateView();

protected:
    /**
    * @brief
    *
    * @fn changeEvent
    * @param e
    */
    void changeEvent(QEvent *e);

private:
    Ui::WatchList *ui;
    QMap<int, QString> variableValue1Map;
    QMap<int, QString> variableValue2Map;
    QMap<int, QString> variableNameMap;
    QList<QTableWidgetItem*> itemList;

public slots:
    void onVariableAdded(QString name, QString address);
    void onVariableChanged(Register *reg);

signals:
    void variableTooltipChanged(QString var, QString val);
};

#endif // WATCHLIST_HPP
